//
#include "ProcessTimer.h"
//
//*****************************************************************************
//!\brief	The Process timer in system    
//!\param	None
//!\retval  None                                                                   
//*****************************************************************************
void ProcessTimer(void)
{
	if(flag.Sys1ms)
	{
		flag.Sys1ms = 0;
		//
		if(delay.uvp)				// the UVP counter
		{
			if(g_CntUVP >= g_DelayTimeUVP)
			{
				g_CntUVP = 0;
				timeout.uvp = 1;
			}
			else
			{
				g_CntUVP++;
			}
		}
		//
		if(delay.ovp)				// the OVP counter
		{
			if(g_CntOVP >= g_DelayTimeOVP)
			{
				g_CntOVP = 0;
				timeout.ovp = 1;
			}
			else
			{
				g_CntOVP++;
			}
		}
		//
		if(delay.ocp)					// the OCP counter
		{
			if(g_CntOCP >= g_DelayTimeOCP)
			{
				g_CntOCP = 0;
				timeout.ocp = 1;
			}
			else
			{
				g_CntOCP++;
			}
		}
		//
		if(delay.lrcp)					// the LRCP counter
		{
			if(g_CntLRCP >= LRCP_TIME)
			{
				g_CntLRCP = 0;
				timeout.lrcp = 1;
			}
			else
			{
				g_CntLRCP++;
			}
		}
		//
		if(delay.lrpp)					// the LRPP counter
		{
			if(g_CntLRPP >= LRPP_TIME)
			{
				g_CntLRPP = 0;
				timeout.lrpp = 1;
			}
			else
			{
				g_CntLRPP++;
			}
		}
		//
		if(delay.otp)					// the OTP counter
		{
			if(g_CntOTP >= g_DelayTimeOTP)
			{
				g_CntOTP = 0;
				timeout.otp = 1;
			}
			else
			{
				g_CntOTP++;
			}
		}
		//
		if(delay.acp)					// the ACP counter
		{
			if(g_CntACP >= g_DelayTimeACP)
			{
				g_CntACP = 0;
				timeout.acp = 1;
			}
			else
			{
				g_CntACP++;
			}
		}
		//
		if(delay.led)					// the LED counter
		{
			if(g_CntLED >= g_DelayTimeLED)
			{
				g_CntLED = 0;
				timeout.led = 1;
			}
			else
			{
				g_CntLED++;
			}
		}
        //
		if(delay.dir_rot)               // the counter of direction
		{
			if(g_DirRotCnt >= 20)
			{
				g_DirRotCnt = 20;
				timeout.dir_rot = 1;
			}
			else
			{
				g_DirRotCnt++;
			}
		}
        //
		if(delay.key1)                  // the counter of key1
		{
			if(g_Key1Cnt >= 20)
			{
				g_Key1Cnt = 20;
				timeout.key1 = 1;
			}
			else
			{
				g_Key1Cnt++;
			}
		}
        //
		if(delay.key2)                  // the counter of key2
		{
			if(g_Key2Cnt >= 20)
			{
				g_Key2Cnt = 20;
				timeout.key2 = 1;
			}
			else
			{
				g_Key2Cnt++;
			}
		}
	}
}

//=========================================================================================


